package com.mall.sun.controller;

import com.mall.sun.model.vo.ResultVO;
import com.mall.sun.utils.CommonUtil;
import com.mall.sun.utils.KaptchaUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * description:  <br>
 * date: 2021/9/25 13:21 <br>
 * author: ztz <br>
 * version: 1.0 <br>
 */

@RequestMapping("/vertify")
@RestController
public class VerifyCodeController {
    @Autowired
    KaptchaUtil kaptchaUtil;

    @GetMapping("/verifyCode")
    public ResultVO verifyCode(){
        try {
            return CommonUtil.ajaxReturn(kaptchaUtil.getRandomCodeBase64());
        } catch (Exception exception) {
            exception.printStackTrace();
        }
        return new ResultVO("验证码出错",500,"内部错误");
    }

}
